﻿using UnityEngine;
using System.Collections;
using Game.Scripts.Managers;
using Engine.Entities.Character;

public class SelectedBuildingModel : MonoBehaviour {

    public Building building;

    #region propertyBinding

    public string Name {
        get {
            if (building == null) return "nd.";
            return building.prototype.name;
        }
    }

    public string logoIconName
    {
        get
        {
            if (building == null) return "Question-mark-icon";
            return building.prototype.name;   
        }
    }

    public string skillIconName
    {
        get
        {
            if (building == null)
                return "Question-mark-icon";
            return ResourceManager.instance.mappingIconSkill[building.prototype.preferredSkill];
        }
    }
    
    public string resourceIconName
    {
        get
        {
            if (building == null) return "Question-mark-icon";
            return ResourceManager.instance.mappingIconResource[building.prototype.resourceProduced.type];
        }
    }

    public uint Livello {
        get
        {
            if (building == null) return 0;
            return building.level;
        }
    }

    public string StrWorkers
    {
        get
        {
            if (building == null) return "-/-";
            return building.workersCount + "/" + MaxWorker;
        }
    }

    public int MaxWorker {
        get
        {
            if (building == null) return 0;
            return (int)(building.prototype.workersPerLevel * building.level);
        }
    }

    public float PercentageWorkers
    {
        get
        {
            if (building == null) return 0;
            return building.workersCount / MaxWorker;
        }
    }

    public string NextProduction
    {
        get
        {
            if (building == null) return "nd.";
            return "--h --m --s";
        }
    }

    #endregion propertyBinding

    void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
